﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using jiaju.Models;
using jiaju.Models.DBModel;

namespace jiaju.Models.DAL
{
    public class PicutreService
    {
        //主页商品
        public static List<Picutre> getPicutre()
        {
            string sql = "select ImgUrl,ProductId from dbo.picture";
            List<Picutre> list = new List<Picutre>();
            SqlDataReader sdr = DBHelp.ExecuteReader(sql);
            while (sdr.Read())
            {
                string ImgUrl = (string)sdr["ImgUrl"];
                int ProductId= (int)sdr["ProductId"];
                Picutre picutre = new Picutre()
                {
                    ImgUrl = ImgUrl,
                    ProductId = ProductId
                };
                list.Add(picutre);
            }
            return list;
        }
    }
}